﻿using System;
using System.Collections.Generic;

using RexToy;

using MGAS.Model.Entity;

namespace MGAS.Model
{
    class EmptyHistoryManager : IHistoryManager
    {
        private ISensorDataBlock _block;
        public void SetDataSource(ISensorDataBlock block)
        {
            ExceptionBase.Throw_IfArgumentNull(block, "block");
            _block = block;
            _block.SensorDataChanged += new EventHandler<SensorDataChangedEventArgs>(_block_SensorDataChanged);
        }

        void _block_SensorDataChanged(object sender, SensorDataChangedEventArgs e)
        {
            var d = _block.GetData(e.Id);
            History h = new History() { SensorID = d.ID, Status = d.Status, Unit = d.Unit, Value = d.Value };

            Debug.WriteLine(h.ToString());
        }

        public IEnumerable<History> FindHistoryByAddress(int addressId)
        {
            return new List<History>();
        }
    }
}
